﻿/**
 * Grid for displaying Consolidator details
 */
Ext.define('Sisconsolid.view.consolidator.List', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.consolidator.list',
    title: translations.consolidatorsPanelTitle,
    iconCls: 'icon_list',
    store: 'Consolidators',
    initComponent: function() {
        var me = this;
        Ext.applyIf(me, {
            columns: {
                defaults: {},
                items: [
                    {
                        text: translations.family,
                        dataIndex: 'family'
                    },
                    {
                        text: translations.firstAndLastName,
                        dataIndex: 'firstName',
                        renderer: function( value, metaData, record, rowIndex, colIndex, store, view ) {
                            return value + ', ' + record.get( 'lastName' )
                        },
                        width: 200
                    },
                    {
                        text: translations.document,
                        dataIndex: 'document'
                    },
                    {
                        text: translations.personalPhone,
                        dataIndex: 'personalPhone'
                    },
                    {
                        text: translations.email,
                        dataIndex: 'email'
                    }
                ]
            },
            dockedItems: [
                {
                    xtype: 'toolbar',
                    dock: 'top',
                    ui: 'footer',
                    items: [
                        {
                            xtype: 'button',
                            itemId: 'add',
                            iconCls: 'icon_add',
                            text: translations.addConsolidator
                        },
						{
                            xtype: 'button',
                            itemId: 'search',
                            iconCls: 'icon_search',
                            text: translations.searchConsolidators
                        },
						{
                            xtype: 'button',
                            itemId: 'clear',
                            iconCls: 'icon_clear',
                            text: translations.clearSearch
                        }
                    ]
                },
                {
                    xtype: 'pagingtoolbar',
                    ui: 'footer',
                    defaultButtonUI: 'default',
                    dock: 'bottom',
                    displayInfo: true,
                    store: me.getStore()
                }
            ]
        });
        me.callParent( arguments );
    }
});